package com.baoxin.chenxixc4coach.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.HashMap;
import java.util.Map;

/**
 * 约课学员
 */
public class CourseStudent implements Parcelable {
    private String photo;
    private String userName;
    private String phone;
    private Map<String, String> map;

    public Integer getOfr_state() {
        String a = map.get("ofr_state");
        Integer b = Integer.parseInt(a);
        return b;
    }

    public String getPhoto() {
        return photo;
    }

    public void setPhoto(String photo) {
        this.photo = photo;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public CourseStudent() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.photo);
        dest.writeString(this.userName);
        dest.writeString(this.phone);
        dest.writeInt(this.map.size());
        for (Map.Entry<String, String> entry : this.map.entrySet()) {
            dest.writeString(entry.getKey());
            dest.writeString(entry.getValue());
        }
    }

    protected CourseStudent(Parcel in) {
        this.photo = in.readString();
        this.userName = in.readString();
        this.phone = in.readString();
        int mapSize = in.readInt();
        this.map = new HashMap<String, String>(mapSize);
        for (int i = 0; i < mapSize; i++) {
            String key = in.readString();
            String value = in.readString();
            this.map.put(key, value);
        }
    }

    public static final Creator<CourseStudent> CREATOR = new Creator<CourseStudent>() {
        @Override
        public CourseStudent createFromParcel(Parcel source) {
            return new CourseStudent(source);
        }

        @Override
        public CourseStudent[] newArray(int size) {
            return new CourseStudent[size];
        }
    };
}
